package com.project.service.impl;

import com.project.bean.StudentBean;
import com.project.mapper.IStudentMapper;
import com.project.service.IStudentService;
import org.apache.ibatis.session.SqlSession;

public class StudentServiceImpl extends BaseService implements IStudentService {
    @Override
    public void add(StudentBean studentBean) {
        SqlSession session = this.getSession();
        IStudentMapper mapper = session.getMapper(IStudentMapper.class);
        mapper.add(studentBean);
        session.commit();
        session.close();
    }

    @Override
    public void del(int id) {
        SqlSession session = this.getSession();
        IStudentMapper mapper = session.getMapper(IStudentMapper.class);
        mapper.del(id);
        session.commit();
        session.close();
    }

    @Override
    public void update(int id, String phone) {
        SqlSession session = this.getSession();
        IStudentMapper mapper = session.getMapper(IStudentMapper.class);
        mapper.update(id,phone);
        session.commit();
        session.close();
    }
}
